﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using YaAppoint.ExamAppies;

namespace YaAppoint.ExamApplies
{
    [RemoteService(isEnabled: false)]
    public class ApplySearchConfigService(IConfiguration configuration) : ApplicationService, IApplySearchConfigService, ITransientDependency
    {

        private IConfiguration _configuration = configuration;


        public Func<Dictionary< string, object>, string,string>? GetAddCondition()
        {
            return ConfigExtraCondition;
        }

        // 配置额外条件
        private string ConfigExtraCondition(Dictionary<string, object> userData,string condition)
        {
            return condition;
        }

        public Func<string>? GetSearchNumber()
        {
            return () =>
            {
                return $@" and (IdCardNumber=@number or CONVERT(varchar(1000),MedicalCardNumber)=@number or  PhoneNumber=@number or PhysicalExamNumber=@number 
               or OutPatientNumber=@number or InPatientNumber=@number or ApplyNumber=@number or Name=@number)";
            };
        }
    }
}
